package com.ybkj.daijia.api.util;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.ybkj.daijia.api.driver.Error;
import java.io.Serializable;
import java.util.Map;

public class ResultTransport implements Serializable {

    /**
     *
     */
    private static final long serialVersionUID = 1L;

    private String ver;

    private int code;

    private String message;

    private Object data;

    private Map<String, Object> settings;

    @JsonIgnore
    public static ResultTransport getErrorBy(Error error) {

        ResultTransport instance = new ResultTransport();
        instance.setCode(error.getCode());
        instance.setMessage(error.getMessage());

        return instance;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public Map<String, Object> getSettings() {
        return settings;
    }

    public void setSettings(Map<String, Object> settings) {
        this.settings = settings;
    }

    public String getVer() {
        return ver;
    }

    public void setVer(String ver) {
        this.ver = ver;
    }

    @Override
    public String toString() {
        return "ResultTransport{" +
            "ver='" + ver + '\'' +
            ", code=" + code +
            ", message='" + message + '\'' +
            ", data=" + data +
            ", settings=" + settings +
            '}';
    }
}
